package com.longge;

public class MaxAscendingSum {

    public int maxAscendingSum(int[] nums) {


        int curSum = nums[0], maxSum = nums[0];

        for (int i = 0; i < nums.length - 1; i++) {

            if (nums[i] < nums[i + 1]) {
                curSum += nums[i + 1];
                maxSum = Math.max(curSum, maxSum);
            } else {
                curSum = nums[i + 1];
                maxSum = Math.max(curSum, maxSum);
            }

        }
        return maxSum;

    }

}
